package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.domain.Evection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AskLeaveMapper;
import com.ruoyi.system.domain.AskLeave;
import com.ruoyi.system.service.IAskLeaveService;

/**
 * 请假申请Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-22
 */
@Service
public class AskLeaveServiceImpl implements IAskLeaveService
{
    @Autowired
    private AskLeaveMapper askLeaveMapper;

    /**
     * 查询请假申请
     *
     * @param id 请假申请主键
     * @return 请假申请
     */
    @Override
    public AskLeave selectAskLeaveById(Long id)
    {
        return askLeaveMapper.selectAskLeaveById(id);
    }

    /**
     * 查询请假申请列表
     *
     * @param askLeave 请假申请
     * @return 请假申请
     */
    @Override
    public List<AskLeave> selectAskLeaveList(AskLeave askLeave)
    {
        return askLeaveMapper.selectAskLeaveList(askLeave);
    }

    /**
     * 新增请假申请
     *
     * @param askLeave 请假申请
     * @return 结果
     */
    @Override
    public int insertAskLeave(AskLeave askLeave)
    {
        return askLeaveMapper.insertAskLeave(askLeave);
    }

    /**
     * 修改请假申请
     *
     * @param askLeave 请假申请
     * @return 结果
     */
    @Override
    public int updateAskLeave(AskLeave askLeave)
    {
        return askLeaveMapper.updateAskLeave(askLeave);
    }

    /**
     * 批量删除请假申请
     *
     * @param ids 需要删除的请假申请主键
     * @return 结果
     */
    @Override
    public int deleteAskLeaveByIds(Long[] ids)
    {
        return askLeaveMapper.deleteAskLeaveByIds(ids);
    }

    /**
     * 删除请假申请信息
     *
     * @param id 请假申请主键
     * @return 结果
     */
    @Override
    public int deleteAskLeaveById(Long id)
    {
        return askLeaveMapper.deleteAskLeaveById(id);
    }

    //查询所有待审批状态
    @Override
    public List<AskLeave> selectListByStatus(Long index) {
        AskLeave askLeave = new AskLeave();
        askLeave.setStatus(index.intValue());
        return askLeaveMapper.selectAskLeaveList(askLeave);
    }
}
